import { _decorator, Component, Node, Label, Sprite } from 'cc';
import { EnEvent } from '../Common/const/EnEvent';
import { GameAPI } from '../Common/GameAPI';
const { ccclass, property } = _decorator;

@ccclass('HeroPanelItem')
export class HeroPanelItem extends Component {

    private heroName: Label;
    private heroDesc: Label;

    start() {
        this.node.on(Node.EventType.TOUCH_END, this.OnClickHeroItem, this);
    }

    OnInit(name, desc) {
        this.heroName = this.node.getChildByName("Name").getComponent(Label);
        this.heroDesc = this.node.getChildByName("Desc").getComponent(Label);
    }

    OnClickHeroItem() {
        GameAPI.FireGEvent(EnEvent.ClickHeroItemEvent, this.node.name);
    }

}


